package com.Gameplay.Combat.Hurtbox;

import com.Gameplay.Combat.Attack.AttackType;
import com.Gameplay.Combat.Hitbox.Hitbox;

import com.Gameplay.Combat.Hitbox.impl.RectangleHitbox;
import com.Gameplay.character.Role.parentRole;

public class LegsHurtbox extends RectangleHitbox {
    //人物腿攻击碰撞箱
    private double Rwidth;
    private double Lwidth;
    private double Uheight;
    private double Dheight;
    private double LegsLength;

    public void setLength(AttackType attackType) {
        if (attackType == AttackType.Light) {
            LegsLength = 140;
        } else if (attackType == AttackType.Middle) {
            LegsLength = 160;
        } else if (attackType == AttackType.Heavy) {
            LegsLength = 180;
        }

    }

    public void setLegsBox(double currentX, double currentY, int facing, AttackType attackType) {
        setLength(attackType);
        if (LegsLength != 0 && facing == 1) {
            currentX += LegsLength;
            currentY = currentY - 100;
            Rwidth = currentX + 100;
            Lwidth = currentX - 100;
            Uheight = currentY + 40;
            Dheight = currentY - 40;
        }
        if (LegsLength != 0 && facing == 0) {
            currentX -= LegsLength;
            currentY = currentY - 100;
            Rwidth = currentX + 100;
            Lwidth = currentX - 100;
            Uheight = currentY + 40;
            Dheight = currentY - 40;
        }
    }

    @Override
    public double getRwidth() {
        return Rwidth;
    }

    @Override
    public double getLwidth() {
        return Lwidth;
    }

    @Override
    public double getUheight() {
        return Uheight;
    }

    @Override
    public double getDheight() {
        return Dheight;
    }
}
